package com.diploma.project.aiqiyi.common.config.feign.codec;

import feign.RequestTemplate;
import feign.codec.EncodeException;
import feign.codec.Encoder;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Type;
import java.util.Objects;

/**
 * @author lisheng
 * @description
 * @date 2018/12/22 14:51
 * @version:
 */
@Slf4j
public final class FeignEncoder implements Encoder {

    final Encoder delegate;

    public FeignEncoder(Encoder delegate) {
        Objects.requireNonNull(delegate, "Encoder must not be null. ");
        this.delegate = delegate;
    }

    @Override
    public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException {
        delegate.encode(object, bodyType, template);
    }
}
